import java.net.*;
import java.io.*;
import java.util.*;

public class TCPReceiver implements Runnable{
	public InputStream is;
	public Vector data;
	
	public TCPReceiver(InputStream s, Vector d){
		is = s;
		data = d;
	}
	
	public void run(){
		try{
			byte[] buffer = new byte[20];
			while(true){
				int l = is.read(buffer);
				String buf = new String(buffer);
				char[] cbuf = new char[l]; 
				buf.getChars(0, l, cbuf, 0);
				String dat = new String();
				for(int i=0;cbuf[i]!='#';i++)dat += cbuf[i];
				data.add(dat);
				//System.out.println("received: " + new String(cbuf));
			}
		}catch(Exception e){System.err.println(e);}
	}

}
